package com.common.sp;

import android.text.TextUtils;

/**
 * 购物信息
 * Created by wgf on 2016/7/25.
 *
 * @author wgf
 * @since v3.8
 */
public class ShoppingSp {

    public static void setTradeAddressInfo(String name, String phone, String addressJoin, String addressID, String provinceCode, String cityCode, String districtID) {
        ShoppingSp.setTradeName(name);
        ShoppingSp.setTradePhone(phone);
        ShoppingSp.setProvinceCode(provinceCode);
        ShoppingSp.setCityCode(cityCode);
        ShoppingSp.setTradeDistrictID(districtID);
        ShoppingSp.setTradeAddress(addressJoin);
        ShoppingSp.setTradeAddressID(addressID);
    }

    public static void clearTradeAddressInfo() {
        ShoppingSp.setTradeName("");
        ShoppingSp.setTradePhone("");
        ShoppingSp.setProvinceCode("");
        ShoppingSp.setCityCode("");
        ShoppingSp.setTradeDistrictID("");
        ShoppingSp.setTradeAddress("");
        ShoppingSp.setTradeAddressID("");
    }

    public static void setTradeName(String tradeName) {
        SharedPreferUtil.getInstance().putString("tradeName", tradeName);
    }

    /** 购买商品留的的姓名 */
    public static String getTradeName() {
        return SharedPreferUtil.getInstance().getString("tradeName", "");
    }

    public static void setTradePhone(String tradePhone) {
        SharedPreferUtil.getInstance().putString("tradePhone", tradePhone);
    }

    /** 购买商品留的联系方式 */
    public static String getTradePhone() {
        return SharedPreferUtil.getInstance().getString("tradePhone", "");
    }

    public static void setTradeAddress(String tradeAddress) {
        SharedPreferUtil.getInstance().putString("tradeAddress", tradeAddress);
    }

    /** 购买商品留的地址 */
    public static String getTradeAddress() {
        return SharedPreferUtil.getInstance().getString("tradeAddress", "");
    }

    public static void setTradeAddressID(String tradeAddressID) {
        SharedPreferUtil.getInstance().putString("tradeAddressID", tradeAddressID);
    }

    /** 购买商品留的地址ID */
    public static String getTradeAddressID() {
        return SharedPreferUtil.getInstance().getString("tradeAddressID", "");
    }

    /** 购买商品留的街道ID */
    public static String getTradeDistrictID() {
        return SharedPreferUtil.getInstance().getString("tradeDistrictID", "");
    }

    public static void setTradeDistrictID(String districtID) {
        SharedPreferUtil.getInstance().putString("tradeDistrictID", districtID);
    }

    public static void setCityCode(String cityCode) {
        SharedPreferUtil.getInstance().putString("cityCode", cityCode);
    }

    /** 购买商品留的城市ID */
    public static String getCityCode() {
        String cityCode = SharedPreferUtil.getInstance().getString("cityCode", "350100");
        if (TextUtils.isEmpty(cityCode)) {
            cityCode = "350100";
        }
        return cityCode;
    }

    public static void setProvinceCode(String provinceCode) {
        SharedPreferUtil.getInstance().putString("provinceCode", provinceCode);
    }

    /** 购买商品留的的省份ID */
    public static String getProvinceCode() {
        String provinceCode = SharedPreferUtil.getInstance().getString("provinceCode", "350000");
        if (TextUtils.isEmpty(provinceCode)) {
            provinceCode = "350000";
        }
        return provinceCode;
    }

    public static String getGoodSearchHistory() {
        return SharedPreferUtil.getInstance().getString("goodSearchHistory", "");
    }

    public static void setGoodSearchHistory(String goodSearchHistory) {
        SharedPreferUtil.getInstance().putString("goodSearchHistory", goodSearchHistory);
    }


}
